From 8f62617cf4f3236d1aed3e8e2e8f1e97247fc593 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 27 Mar 2008 11:03:45 +0000 Subject: [PATCH] x86, vmx: HVM guests are allowed to modify CR2, and the written value should be remembered by Xen. Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/vmx/x86_32/exits.S | 4 ++++ xen/arch/x86/hvm/vmx/x86_64/exits.S | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/xen/arch/x86/hvm/vmx/x86_32/exits.S b/xen/arch/x86/hvm/vmx/x86_32/exits.S index 70cd1dae36..11db8cfc21 100644 --- a/xen/arch/x86/hvm/vmx/x86_32/exits.S +++ b/xen/arch/x86/hvm/vmx/x86_32/exits.S @@ -60,6 +60,7 @@ ALIGN ENTRY(vmx_asm_vmexit_handler) HVM_SAVE_ALL_NOSEGREGS + GET_CURRENT(%ebx) movl $GUEST_RIP,%eax VMREAD(UREGS_eip) @@ -68,6 +69,9 @@ ENTRY(vmx_asm_vmexit_handler) movl $GUEST_RFLAGS,%eax VMREAD(UREGS_eflags) + movl %cr2,%eax + movl %eax,VCPU_hvm_guest_cr2(%ebx) + #ifndef NDEBUG movw $0xbeef,%ax movw %ax,UREGS_error_code(%esp) diff --git a/xen/arch/x86/hvm/vmx/x86_64/exits.S b/xen/arch/x86/hvm/vmx/x86_64/exits.S index fda4f179b1..48da4869bd 100644 --- a/xen/arch/x86/hvm/vmx/x86_64/exits.S +++ b/xen/arch/x86/hvm/vmx/x86_64/exits.S @@ -76,6 +76,7 @@ ALIGN ENTRY(vmx_asm_vmexit_handler) HVM_SAVE_ALL_NOSEGREGS + GET_CURRENT(%rbx) leaq UREGS_rip(%rsp),%rdi movl $GUEST_RIP,%eax @@ -86,6 +87,9 @@ ENTRY(vmx_asm_vmexit_handler) movl $GUEST_RFLAGS,%eax VMREAD(UREGS_eflags) + movq %cr2,%rax + movq %rax,VCPU_hvm_guest_cr2(%rbx) + #ifndef NDEBUG movw $0xbeef,%ax movw %ax,UREGS_error_code(%rsp) -- 2.30.2